<template>
    <page-body >
        <view class="page" >
    <view class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex changePwdOldCode_flex_0_higd"    :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
            <view   class='flex flex-wrap align-stretch justify-between changePwdOldCode_fd0_0_higd'      >
            <view   class='flex flex-wrap align-center changePwdOldCode_fd0_0_c0_higd'   @tap.stop="handleJumpDiy" data-type="back" data-url="1"   >
        <text class='fu-iconfont2  changePwdOldCode_fd0_0_c0_c0_higd'  >&#xe794;</text>
</view>
    <view   class='flex flex-wrap align-center'      >
        <text class='changePwdOldCode_fd0_0_c1_c0_higd'  >{{$t('修改密码')}}</text>
</view>
    <view   class='flex align-center justify-end changePwdOldCode_fd0_0_c2_higd'      >
        </view>
</view>

        </view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"  ></view>
<!---改密-旧密码验证表单flex布局开始-->
 <view class="flex flex-direction flex-wrap align-stretch changePwdOldCode_flex_1_higd"    >
            <view   class='flex flex-wrap align-center changePwdOldCode_fd1_0_higd'      >
        <text class='changePwdOldCode_fd1_0_c0_higd'  >{{$t('旧密码')}}</text>
<benben-input class='flex-sub changePwdOldCode_fd1_0_c1_higd'   type="text" :focus='true' :placeholder="$t('请输入旧密码')" confirm-type="done" :maxlength="12" :password='true' placeholder-style="color:rgba(156, 156, 156, 1);font-size:32rpx"  v-model="oldPwd" />
</view>
    <view   class='flex flex-wrap align-center changePwdOldCode_fd1_0_higd'      >
        <text class='changePwdOldCode_fd1_0_c0_higd'  >{{$t('新密码')}}</text>
<benben-input class='flex-sub changePwdOldCode_fd1_0_c1_higd'   type="text" :placeholder="$t('请输入新密码')" confirm-type="done" :maxlength="12" :password='true' placeholder-style="color:rgba(156, 156, 156, 1);font-size:32rpx"  v-model="newPwd" />
</view>
    <view   class='flex flex-wrap align-center changePwdOldCode_fd1_0_higd'      >
        <text class='changePwdOldCode_fd1_2_c0_higd'  >{{$t('确认新密码')}}</text>
<benben-input class='flex-sub changePwdOldCode_fd1_0_c1_higd'   type="text" :placeholder="$t('请再次输入新密码')" confirm-type="done" :maxlength="12" :password='true' placeholder-style="color:rgba(156, 156, 156, 1);font-size:32rpx"  v-model="qrPwd" />
</view>
<button class='changePwdOldCode_fd1_3_higd'  @tap.stop="checkPwdFunc()"  >{{$t('完成')}}</button>
</view>
        
<!---改密-旧密码验证表单flex布局结束-->
    
    
        </view>
    </page-body>
</template>
<script>
    import {validate} from '@/common/utils/validate.js'
    
    export default {
        components:{},
        
        
        data(){
			return {"oldPwd":"","newPwd":"","qrPwd":""};
		},
		computed:{
            
		},
		watch:{},
		onLoad(options){
            
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
            
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                            //校验密码
                async checkPwdFunc(){
                                if(!validate(this.oldPwd,'require')){
                 this.$message.info(global.i18n.t('请输入旧密码'));
                 return false;
            }
            if(!validate(this.oldPwd,'password')){
                 this.$message.info(global.i18n.t('请输入密码（6~12位字母+数字）'));
                 return false;
            }
            if(!validate(this.newPwd,'require')){
                 this.$message.info(global.i18n.t('请输入新密码'));
                 return false;
            }
            if(!validate(this.newPwd,'password')){
                 this.$message.info(global.i18n.t('请输入新密码（6~12位字母+数字）'));
                 return false;
            }
            if(!validate(this.qrPwd,'require')){
                 this.$message.info(global.i18n.t('请输入确认密码'));
                 return false;
            }
            if(!validate(this.qrPwd,'password')){
                 this.$message.info(global.i18n.t('请输入确认密码（6~12位字母+数字）'));
                 return false;
            }
            if(!(this.newPwd == this.qrPwd)){
                 this.$message.info(global.i18n.t('两次输入密码不一致'));
                 return false;
            }
    //请求方法
    //数据验证
    
  let data5da9ab4c4c7af = await this.$api.post(global.apiUrls.post5da9ab4c4c7af, {
    security_code:this.oldPwd,password:this.newPwd,password_code:this.qrPwd
  });
  
  if (data5da9ab4c4c7af.data.code != 1) {
    this.$message.info(data5da9ab4c4c7af.data.msg);
    return
  } 
  let info5da9ab4c4c7af = data5da9ab4c4c7af.data;
  
  
                this.$store.commit('logout')
                setTimeout(()=>{
            this.$urouter.reLaunch(`/pagetabBar/loginPage/loginPage`);
      },500)
                }
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:#fff;background-size: 100% auto;
            .changePwdOldCode_flex_1_higd{
        font-size:32rpx;background:#fff;background-size:100% auto !important;padding:0rpx 32rpx 0rpx 32rpx;
        .changePwdOldCode_fd1_3_higd{
        border-radius:44rpx 44rpx 44rpx 44rpx;font-size:32rpx;background:rgba(211, 42, 41, 1);color:var(--benbenFontColor3);width:686rpx;height:88rpx;line-height:88rpx;font-weight:500;margin:300rpx 0rpx 0rpx 0rpx;
    }}
    .changePwdOldCode_fd1_0_higd{
        padding:32rpx 0rpx 32rpx 0rpx;border-bottom:1px solid #eee;
    }
    .changePwdOldCode_fd1_0_c0_higd{
        font-size:32rpx;font-weight:400;color:var(--benbenFontColor0);margin:0rpx 48rpx 0rpx 0rpx;
    }
    .changePwdOldCode_fd1_0_c1_higd{
        line-height:45rpx;font-size:32rpx;font-weight:400;color:var(--benbenFontColor0);
    }
    .changePwdOldCode_fd1_2_c0_higd{
        font-size:32rpx;font-weight:400;color:var(--benbenFontColor0);width:182rpx;
    }
    .changePwdOldCode_flex_0_higd{
        width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background:#fff;background-size:100% auto !important;border-bottom:1px solid #eee;
        .changePwdOldCode_fd0_0_higd{
        padding:0rpx 32rpx 0rpx 32rpx;line-height:88rpx;
        .changePwdOldCode_fd0_0_c0_higd{
        width:100rpx;
        .changePwdOldCode_fd0_0_c0_c0_higd{
        font-size:36rpx;font-weight:400;color:#333;
    }}    .changePwdOldCode_fd0_0_c1_c0_higd{
        font-size:36rpx;font-weight:500;color:var(--benbenFontColor0);line-height:50rpx;
    }    .changePwdOldCode_fd0_0_c2_higd{
        padding:0rpx 0rpx 0rpx 0rpx;width:100rpx;
    }}}}
</style>